<!-- Dom模板 -->
<template>
  <div class="box">
    <!-- Dom内容 -->
    <div class="top">
      <span
        id="zuojiantou"
        @click="back"
        class="iconfont icon-arrow-left-copy-copy"
      ></span>
      <span class="pay">收银台</span>
    </div>
    <div class="con">
      <p>Maco蛋充值</p>
      <p>
        ￥<span>{{ mon.money }}</span>
      </p>
      <p class="receipt">
        <span id="left">收款方</span>
        <span id="right">美可玩故事</span>
      </p>
      <button class="low" @click="pay">立即支付</button>
    </div>
    <transition name="tan">
      <div class="alert" v-if="flag">
        <p>确认支付&nbsp;&nbsp;&nbsp;{{ mon.money }}元</p>
        <div class="btn">
          <button @click="yes">确定</button>
          <button @click="no">取消</button>
        </div>
      </div>
    </transition>
    <div class="zhe" v-if="flags"></div>
  </div>
</template>

<script>
// import a from './a'; // 引入组件
import * as apis from "../../api/home"
export default {
  props: ["money"],
  name: "",
  data() {
    return {
      msg: "测试",
      mon: "",
      flag: false,
      flags: false,
    };
  },
  // 生命周期 - 创建完成（访问当前this实例）
  created() {},
  // 生命周期 - 挂载完成（访问DOM元素）
  mounted() {
    this.mon = JSON.parse(this.$route.query.item);
  },
  // Vue方法定义
  methods: {
    back() {
      this.$router.push("/payMacoAge");
    },
    pay() {
      this.flag = true;
      this.flags = true;
    },
    yes() {
      // this.$store.commit("chat/age", {
      //   item: this.mon,
      // });
      console.log(this.mon.money * 10 )
      apis.maneyMacop({maneyMacos : this.mon.money * 10,yonghu:this.$store.state.order.user.title}).then((str)=>{
        console.log(str)
      })
      this.flag = false;
      this.flags = false;
    },
    no() {
      this.flag = false;
      this.flags = false;
    },
  },
};
</script>

<style scoped>
@import url("../../../assets/font/iconfont.css");

/* @import url(''); 引入css类 */
.box {
  position: fixed;
  top: 0;
  width: 100vw;
  height: 100vh;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  background: rgb(246, 246, 246);
}
.top {
  width: 100%;
  height: 55px;
  display: flex;
  line-height: 55px;
  border-bottom: 1px solid #ccc;
}
#zuojiantou {
  font-size: 24px;
  font-weight: 600;
  color: #c3c3c3;
  padding-left: 5px;
}
.pay {
  padding-left: 35%;
  font-size: 18px;
  font-weight: 600;
}
.con {
  text-align: center;
  margin-top: 15px;
  line-height: 60px;
}
.con span {
  font-size: 28px;
}
.con .receipt span {
  font-size: 16px;
}
.con .receipt {
  width: 100%;
  height: 50px;
  line-height: 50px;
  /* display: flex;
  justify-content: space-around; */
  border-top: 1px solid rgb(218, 215, 215);
  border-bottom: 1px solid rgb(234, 234, 234);
  background: white;
}
#left {
  color: rgb(179, 179, 179);
  float: left;
  padding-left: 25px;
}
#right {
  color: black;
  float: right;
  font-size: 17px;
  padding-right: 25px;
}
.low {
  width: 90%;
  margin-top: 30px;
  height: 50px;
  border: none;
  background: rgb(69, 172, 88);
  color: white;
  font-size: 16px;
  border-radius: 5px;
}
.zhe {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(97, 97, 99, 0.4);
}
.alert {
  margin-top: 50px;
  line-height: 60px;
  text-align: center;
  position: absolute;
  top: 30%;
  left: 10%;
  z-index: 999;
  background: white;
  width: 80%;
  height: 150px;
  border-radius: 15px;
}
.alert p {
  font-size: 18px;
  margin-top: 15px;
}
.btn {
  position: absolute;
  border-radius: 0 0 15px 15px;
  bottom: 0;
  width: 100%;
  background: none;
  display: flex;
  overflow: hidden;
  justify-content: space-around;
}
.btn button {
  width: 100%;
  overflow: hidden;
  height: 53px;
  border: none;
  font-size: 16px;
}
.btn button:nth-child(1) {
  background: rgb(254, 90, 46);
  color: white;
}
.btn button:nth-child(2) {
  background: white;
  /* color: rgb(120, 135, 170); */
}
.tan-enter{
  opacity:0;
}
.tan-leave-to{
  opacity: 0;
}
.alert{
  transition: all 0.5s ease;
}
</style>